package com.shiyi.design.chain;

/**
 *
 * 责任链模式
 *
 * @author wangzhanshuai
 * @date 2021/2/5 5:03 下午
 * @since 1.0
 */
public class Client {

    public static void main(String[] args) {
        MyRequest myRequest = new MyRequest(":), hello, <script />, shiyi.com");
        MyResponse myResponse = new MyResponse("");
        MyFilterChain myFilterChain = new MyFilterChain();
        myFilterChain.add(new HtmlFilter()).add(new FaceFilter());

        MyFilterChain myFilterChain1 = new MyFilterChain();
        myFilterChain1.add(new UrlFilter());

        myFilterChain.add(myFilterChain1);

        myFilterChain.doFilter(myRequest, myResponse, myFilterChain);
        System.out.println(myRequest.getMsg());
        System.out.println(myResponse.getMsg());
    }
}
